package cn.com.greatwall.common.utils;

import java.io.PrintWriter;
import java.io.StringWriter;

/** 
* @Author herw
* @Time 2020-06-22 11:26:55 AM 
* @Version 1.0
* @Description: 异常工具
*/
public class ThrowableUtil {
    /**
     * 获取堆栈信息
     */
    public static String getStackTrace(Throwable throwable){
        StringWriter sw = new StringWriter();
        try (PrintWriter pw = new PrintWriter(sw)) {
            throwable.printStackTrace(pw);
            return sw.toString();
        }
    }
}
